package cn.gz.demo.ui;


import android.os.Bundle;

import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;

import java.util.ArrayList;
import java.util.List;

import cn.gz.demo.R;
import cn.gz.demo.adapter.ScrollViewAdapter;
import cn.gz.demo.databinding.ScrollViewBinding;
import cn.gz.demo.dto.User;
import cn.gz.demo.ui.base.BaseActivity;

/**
 * Created by Lyz on 2017/3/8.
 */
public class ScrollViewActivity extends BaseActivity {
    private ScrollViewBinding binding;
    private List<User> list = new ArrayList<>();
    private ScrollViewAdapter adapter;
    private User user;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_scrollview);

        for (int i = 0; i < 20; i++) {
            user = new User();
            user.setName("刘远志");
            user.setAge("30");
            user.setSex("男");
            list.add(user);
        }
        binding.content.setLayoutManager(new LinearLayoutManager(context));
        adapter = new ScrollViewAdapter(context, list);
        binding.content.setAdapter(adapter);

    }
}
